package com.ws.universal.tools.wsui.headle;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.ImageView;

import com.ws.universal.tools.wsui.help.QMUISkinHelper;

import org.jetbrains.annotations.NotNull;

public class QMUISkinRuleSrcHandler extends QMUISkinRuleDrawableHandler {
    @Override
    protected void handle(@NotNull View view, @NotNull String name, Drawable drawable) {

        if (view instanceof ImageView) {
            ((ImageView) view).setImageDrawable(drawable);
        } else if (view instanceof CompoundButton) {
            ((CompoundButton) view).setButtonDrawable(drawable);
        } else {
            QMUISkinHelper.warnRuleNotSupport(view, name);
        }
    }
}
